Skip to content

Conversation

@MasterOdin
Copy link
Member

@MasterOdin MasterOdin commented Jun 10, 2025

PR updates our usage of phpstan from 1.9.x to 1.12.x, which is the latest minor release of the 1.x branch. While preferable to move to phpstan 2.1, per #2362, there's a lot of errors that get thrown out that we'd need to fix before doing so, as I don't want to add them to the baseline.

@MasterOdin MasterOdin marked this pull request as ready for review October 26, 2025 20:44
$selectColumns = array_filter($selectColumns, 'strlen');
$writeColumns = array_filter($writeColumns, 'strlen');
$selectColumns = array_filter($selectColumns, fn($v) => $v && strlen($v) > 0);
$writeColumns = array_filter($writeColumns, fn($v) => $v && strlen($v) > 0);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per phpstan/phpstan#2266, the maintainer of phpstan made a conscious decision to encode this where the callable passed to array_filter must return a boolean value (I think), which strlen doesn't do.

Passing 'strlen' would also implicitly filter out both emtpy strings and false values, whereas doing it explicitly throws a type error passing a boolean to strlen, so this is certainly more type safe in general I guess.

@MasterOdin MasterOdin merged commit 16c2d26 into 0.x Oct 26, 2025
12 checks passed
@MasterOdin MasterOdin deleted the chore-phpstan-1-12 branch October 26, 2025 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants